<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>课程详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        }
        
        body {
            max-width: 750px;
            margin: 0 auto;
            color: #333;
            background-color: #f5f5f5;
        }
        
        .header {
            background-color: #2196F3;
            color: white;
            padding: 15px;
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            position: relative;
        }
        
        .back-btn {
            position: absolute;
            left: 15px;
            top: 15px;
            font-size: 16px;
        }
        
        .course-info {
            background-color: white;
            padding: 15px;
            margin-bottom: 12px;
        }
        
        .course-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #2196F3;
        }
        
        .course-meta {
            display: flex;
            margin-bottom: 15px;
        }
        
        .meta-item {
            flex: 1;
            color: #666;
            font-size: 14px;
        }
        
        .course-content {
            font-size: 15px;
            line-height: 1.6;
        }
        
        .section-title {
            padding: 12px 15px;
            font-size: 16px;
            font-weight: bold;
            border-bottom: 1px solid #eee;
            background-color: #f9f9f9;
        }
        
        .purchase-list {
            background-color: white;
        }
        
        .purchase-item {
            padding: 15px;
            border-bottom: 1px solid #eee;
        }
        
        .purchase-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
        }
        
        .purchase-time {
            color: #666;
            font-size: 14px;
        }
        
        .purchase-status {
            font-size: 14px;
            padding: 2px 8px;
            border-radius: 3px;
        }
        
        .status-paid {
            background-color: #e8f5e9;
            color: #2e7d32;
        }
        
        .status-pending {
            background-color: #fff8e1;
            color: #ff8f00;
        }
        
        .status-refund {
            background-color: #ffebee;
            color: #c62828;
        }
        
        .purchase-detail {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
        }
        
        .purchase-amount {
            font-weight: bold;
            color: #2196F3;
        }
        
        .empty-tip {
            text-align: center;
            padding: 30px 0;
            color: #999;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="back-btn" onclick="history.back()">←</div>
        课程详情
    </div>
    
    <div class="course-info">
        <div class="course-title">HTML5与CSS3基础教程</div>
        <div class="course-meta">
            <div class="meta-item">时长: 20小时</div>
            <div class="meta-item">价格: ¥99.00</div>
            <div class="meta-item">学员: 128人</div>
        </div>
        <div class="course-content">
            本课程从零开始讲解HTML5和CSS3的基础知识，包括HTML5新标签、语义化结构、CSS3选择器、盒模型、Flex布局、响应式设计等核心内容。通过大量实例演示，帮助学员快速掌握现代网页开发基础技术。
        </div>
    </div>
    
    <div class="section-title">购买记录</div>
    
    <div class="purchase-list">
        <div class="purchase-item">
            <div class="purchase-header">
                <div class="purchase-time">2023-05-15 14:30</div>
                <div class="purchase-status status-paid">已入账</div>
            </div>
            <div class="purchase-detail">
                <div>用户: 张**</div>
                <div class="purchase-amount">¥99.00</div>
            </div>
        </div>
        
        <div class="purchase-item">
            <div class="purchase-header">
                <div class="purchase-time">2023-05-10 09:15</div>
                <div class="purchase-status status-refund">有退款</div>
            </div>
            <div class="purchase-detail">
                <div>用户: 李**</div>
                <div class="purchase-amount">¥99.00</div>
            </div>
        </div>
        
        <div class="purchase-item">
            <div class="purchase-header">
                <div class="purchase-time">2023-05-08 16:45</div>
                <div class="purchase-status status-paid">已入账</div>
            </div>
            <div class="purchase-detail">
                <div>用户: 王**</div>
                <div class="purchase-amount">¥99.00</div>
            </div>
        </div>
        
        <div class="purchase-item">
            <div class="purchase-header">
                <div class="purchase-time">2023-05-05 11:20</div>
                <div class="purchase-status status-pending">未入账</div>
            </div>
            <div class="purchase-detail">
                <div>用户: 赵**</div>
                <div class="purchase-amount">¥99.00</div>
            </div>
        </div>
    </div>
    
    <script>
        // 这里可以添加从后端获取课程详情和购买记录的逻辑
        // 例如：
        /*
        function loadCourseDetail(courseId) {
            fetch(`/api/course/${courseId}`)
                .then(response => response.json())
                .then(data => {
                    // 更新页面内容
                    document.querySelector('.course-title').textContent = data.title;
                    // 其他数据更新...
                });
                
            fetch(`/api/course/${courseId}/purchases`)
                .then(response => response.json())
                .then(data => {
                    // 更新购买记录列表
                    const list = document.querySelector('.purchase-list');
                    list.innerHTML = ''; // 清空现有内容
                    
                    data.forEach(item => {
                        const statusClass = 
                            item.status === 'paid' ? 'status-paid' :
                            item.status === 'pending' ? 'status-pending' : 'status-refund';
                            
                        const statusText = 
                            item.status === 'paid' ? '已入账' :
                            item.status === 'pending' ? '未入账' : '有退款';
                            
                        list.innerHTML += `
                            <div class="purchase-item">
                                <div class="purchase-header">
                                    <div class="purchase-time">${item.orderTime}</div>
                                    <div class="purchase-status ${statusClass}">${statusText}</div>
                                </div>
                                <div class="purchase-detail">
                                    <div>用户: ${item.userName}</div>
                                    <div class="purchase-amount">¥${item.amount.toFixed(2)}</div>
                                </div>
                            </div>
                        `;
                    });
                });
        }
        
        // 页面加载时调用
        window.onload = function() {
            const courseId = new URLSearchParams(window.location.search).get('id');
            if (courseId) {
                loadCourseDetail(courseId);
            }
        };
        */
    </script>
</body>
</html>